package com.hs.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.MyNotice;
import com.hs.sfzy.mapper.MyNoticeMapper;
import com.hs.sfzy.service.MyNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName MyNoticeServiceImpl
 * @Description TODO
 * @Author liuzhuo
 * @Date 2025年08月13日 10:33
 * @Version 1.0
 */
@Service
public class MyNoticeServiceImpl implements MyNoticeService {
    @Autowired
    private MyNoticeMapper myNoticeMapper;
    @Override
    public int insert(MyNotice myNotice) {
        return myNoticeMapper.insert(myNotice);
    }

    @Override
    public int updateById(MyNotice myNotice) {
        return myNoticeMapper.updateById(myNotice);
    }

    @Override
    public int deleteById(int id) {
        return myNoticeMapper.deleteById(id);
    }

    @Override
    public MyNotice selectById(int id) {
        return myNoticeMapper.selectById(id);
    }

    @Override
    public PageInfo<MyNotice> getMyNoticeList(MyNotice myNotice, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<MyNotice> list = myNoticeMapper.getMyNoticeList(myNotice);
        return new PageInfo<>(list);
    }

    @Override
    public List<MyNotice> getByUserId(Integer userId) {
        return myNoticeMapper.getByUserId(userId);
    }


}
